package cn.hh.wechatkit.config;

import cn.hh.wechatkit.util.WxSignUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpServletResponse;

/**
 * Created this one by HMH on 2017/5/22.
 */
public class WxSignChecker {
    static private Logger logger = LoggerFactory.getLogger(WxSignChecker.class);

    public static String check(String signature, String timestamp, String nonce, String echostr, String token) {
        logger.debug("开始认证服务器");
        String mySign = WxSignUtil.signaure("",timestamp, nonce, token);
        if(signature.equals(mySign)){
            logger.debug("认证通过");
            return echostr;
        }
        else{
            logger.debug("认证失败");
            return mySign;
        }
    }
}
